<?php

namespace App\Http\Middleware;

use Closure;
use DB;

class CheckClose
{
    /**
     * Handle an incoming request.
     *
     * @param  \Illuminate\Http\Request  $request
     * @param  \Closure  $next
     * @return mixed
     */
    public function handle($request, Closure $next)
    {
		// 获取现有网站配置
		$webconfig = DB::table('webconfig')
				-> select('isclose')
				-> first();
		// 2 关闭状态
		if( $webconfig->isclose == '2' )
		{
			return redirect('/rest');
		}
        return $next($request);
    }
}
